package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotaton.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: SetmealMapper
 * Package: com.sky.mapper
 * Description:
 *
 * @Autehor 屈子岩
 * @Create 2024/9/10 15:42
 * @Version 1.0
 */
@Mapper
public interface SetmealMapper {

    /**
     * 分页查询
     *
     * @param setmealPageQueryDTO
     */

    Page<Setmeal> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);


    /**
     * 新增套餐
     *
     * @param setmeal
     */
    @AutoFill(value = OperationType.INSERT)
    void insert(Setmeal setmeal);

    @Select("select * from setmeal where id = #{id}")
    SetmealVO getById(Long id);

    /**
     * 修改套餐状态
     *
     * @param setmeal
     */
    @AutoFill(value = OperationType.UPDATE)
    void update(Setmeal setmeal);

    @Delete("delete from setmeal where id = #{id}")
    void deleteById(Long id);

    @Select("select * from setmeal where category_id = #{id}")
    List<Setmeal> getBycategoryId(Long id);

}
